import axios from '@/config/httpConfig'

export function getWeather() {
    // const path = '/weatherUrl/v3/weather/now.json?key=SzkqTNE81WzB2FWSa&location=beijing&language=zh-Hans&unit=c'
    const path = '/intelligence/api/index/weather';
    return axios.get(path, { isShowLoading: false })
}

export function getNotices() {
    const path = '/intelligence/index.php/api/index/notice';
    return axios.get(path, { isShowLoading: false })
}

export function getScreen() {
    const path = '/intelligence/index.php/api/index/screen';
    return axios.get(path, { isShowLoading: false })
}

export function getCompanyTitle() {
    const path = '/intelligence/api/index/company_type';
    return axios.get(path, { isShowLoading: false })
}

export function getCompanyActive() {
    const path = '/intelligence/api/index/seven';
    return axios.get(path, { isShowLoading: false })
}

export function fetchPermission() {
    // return axios.get('/user/info')
    return new Promise((resolve, reject) => {
        let res = {
            name: 'admin',
        };
        resolve(res)
    })
}

// 获取用户列表
export function getUserList() {
    return axios.get('/user/list')
}
// 获取角色列表
export function getRoleList() {
    return axios.get('/role/list')
}
// 获取所有权限
export function getAllPermissiion() {
    return axios.get('/permission/all')
}
// 获取一级权限列表
export function getFirstLevel() {
    return axios.get('/permission/resource')
}
// 获取次级权限列表
export function getNextLevel(id) {
    return axios.get(`/permission/level?id=${id}`)
}
export function login(data) {
    return axios.post('/user/login', data)
}
